package com.ibeacon.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class LoginController {

	@RequestMapping("/systemlogin")
	public String login(ModelMap model ,HttpServletResponse response,HttpServletRequest request ){
		String userName  = request.getParameter("userName");
		String userPass = request.getParameter("userPass");
		String message = "";
		if(userName==null||"".equals(userName)){
			message = "用户名不能为空！";
		}else if(userPass==null||"".equals(userPass)){
			message = "密码不能为空！";
		}else if(!"root".equals(userName)||!"123456".equals(userPass)){
			message = "用户名密码错误！";
		}
		model.addAttribute("message", message);
		if("".equals(message)){
			return "common/main";
		}else{
			return "common/login";
		}
		
		
	}
}
